import http from '../utils/request';

const { get, post } = http('admin');
// 获取最近的设备数据
export const getLatestMonitorData = params => get('/api/data/monitorData/queryLatestMonitorData', params);
// 通过时间段获取设备数据
export const getMonitorData = params => get('/api/data/monitorData/queryMonitorData', params);
// 通过时间段获取设备数据分页
export const getMonitorDataPage = params => get('/api/data/monitorData/queryMonitorDataPage', params);
// 获取模板监控项列表
export const dataTemplateItem = params => get(`/api/equip/dataTemplateItem/${params.id}`);
// 获取模板列表
export const queryDataTemplates = params => get('/api/equip/dataTemplateItem/queryDataTemplates', params);
// 创建模板
export const createDataTemplate = params => post('/api/equip/dataTemplateItem/createDataTemplate', params);
// 创建模板项
export const createDataTemplateItem = params => post('/api/equip/dataTemplateItem/createDataTemplateItem', params);
// 更新模板
export const updateDataTemplate = params => post('/api/equip/dataTemplateItem/updateDataTemplate', params);
// 更新模板项目
export const updateDataTemplateItem = params => post('/api/equip/dataTemplateItem/updateDataTemplateItem', params);
// 删除模板
export const deleteDataTemplate = params => post('/api/equip/dataTemplateItem/deleteDataTemplate', params);
// 类型列表
export const queryTypeSelectList = params => get('/api/equip/monitorField/queryTypeSelectList', params);
// 删除模板项目
export const deleteDataTemplateItem = params => post('/api/equip/dataTemplateItem/deleteDataTemplateItem', params);
// 获取模板监控项列表
export const queryDataTemplateItems = params => get(`/api/equip/dataTemplateItem/queryDataTemplateItems/${params.dataTemplateId}`);

// 添加监控字段
export const createMonitorField = params => post('/api/equip/monitorField/createMonitorField', params);
// 编辑监控字段
export const updatemonitorfield = params => post('/api/equip/monitorField/updatemonitorfield', params);
// queryMonitorFiledList
export const queryMonitorFiledList = params => get('/api/equip/monitorField/queryMonitorFiledList', params);
// deleteMonitorField
export const deleteMonitorField = params => post('/api/equip/monitorField/deleteMonitorField', params);
// queryRealTimeMonitorData
export const queryRealTimeMonitorData = params => get(`/api/data/monitorData/queryRealTimeMonitorData/${params.deviceNo}`, params);
